ScrollAreaTocWidget
Base classes
| Name | Children | Inherits |
|---|---|---|
| TreeView prettyqt.widgets.treeview Default model/view implementation of a tree view. |
â‹” Inheritance diagram
graph TD
1656082603["custom_widgets.ScrollAreaTocWidget"]
1283923056["widgets.TreeView"]
1058239441["widgets.TreeViewMixin"]
3836649406["widgets.AbstractItemViewMixin"]
1259044718["widgets.AbstractScrollAreaMixin"]
1689631995["widgets.FrameMixin"]
829357528["widgets.WidgetMixin"]
3227531497["core.ObjectMixin"]
2751680898["builtins.object"]
625385617["gui.PaintDeviceMixin"]
2426194723["QtWidgets.QTreeView"]
3038536384["QtWidgets.QAbstractItemView"]
1459025998["QtWidgets.QAbstractScrollArea"]
3822057598["QtWidgets.QFrame"]
3620195106["QtWidgets.QWidget"]
3984060476["QtCore.QObject"]
37984305["Shiboken.Object"]
673956333["QtGui.QPaintDevice"]
1283923056 --> 1656082603
1058239441 --> 1283923056
3836649406 --> 1058239441
1259044718 --> 3836649406
1689631995 --> 1259044718
829357528 --> 1689631995
3227531497 --> 829357528
2751680898 --> 3227531497
625385617 --> 829357528
2751680898 --> 625385617
2751680898 --> 829357528
2751680898 --> 1689631995
2751680898 --> 1259044718
2751680898 --> 3836649406
2751680898 --> 1058239441
2426194723 --> 1283923056
3038536384 --> 2426194723
1459025998 --> 3038536384
3822057598 --> 1459025998
3620195106 --> 3822057598
3984060476 --> 3620195106
37984305 --> 3984060476
2751680898 --> 37984305
673956333 --> 3620195106
37984305 --> 673956333
🛈 DocStrings
Bases: TreeView
Source code in prettyqt/custom_widgets/scrollareatocwidget.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
__init__(scrollarea: widgets.ScrollArea, orientation: constants.Orientation | constants.OrientationStr = constants.VERTICAL, widget_class: type[widgets.QWidget] = widgets.QWidget, **kwargs) -> None
A TreeView which can show a Table-of-contents list based on a given ScrollArea.
With default settings, it will scan the widgets contained in the scrollArea for a windowTitle. These widgets will be shown in the TreeView, and the TreeView selection will be synced to what is currently visible in the ScrollArea. This basically emulates the behaviour of many websites (like the [Qt Website][https://doc.qt.io/qt-6/supported-platforms.html]) or from VS code settings.
You can set up the Toc Tree by passing a ScrollArea instance:
widget = widgets.Widget()
layout = widget.set_layout("horizontal")
scrollarea = widgets.ScrollArea()
# add some widgets to the ScrollArea here
# ...
toc = ScrollAreaTocWidget(scrollarea)
layout.add(toc)
layout.add(scrollarea)
The Toc tree can be configured to use other properties for populating than windowTitle. You can also set a widget class filter if you only want a specific widget class to be shown.
The widget supports 3 different scroll modes:
1) Single: Only one row in the Tree will be highlighted. (the one which equals the topmost one from the scrollArea) 2) Multi: All rows which equal to visible widgets in the ScrollArea will be shown. 3) HeadersOnly: like Single, but only highlights top-level widgets from the ScrollArea.
There are also two different expand modes to choose from:
1) ExpandAll: All subsections are always expanded. 2) on_focus: Only the section containing the focused item is expanded.
This widget is used by ConfigWidget.
Source code in prettyqt/custom_widgets/scrollareatocwidget.py
set_widget(widget: widgets.ScrollArea)
Set the ScrollArea widget to follow.